import request from '@/utils/request'

//获取Spu列表
export function reqSpuList({ page, limit, category3Id }) {
  return request({
    url: `/admin/product/${page}/${limit}`,
    method: 'get',
    params: {
      category3Id
    }
  })
}

//获取销售属性列表
export function reqSaleAttrList() {
  return request({
    url: `/admin/product/baseSaleAttrList`,
    method: 'get'
  })
}

//新增Spu
export function reqsaveSpuInfo(data) {
  return request({
    url: `/admin/product/saveSpuInfo`,
    method: 'post',
    data
  })
}

//获取Spu图片列表
export function reqSpuImageListById(spuId) {
  return request({
    url: `/admin/product/spuImageList/${spuId}`,
    method: 'get'
  })
}

//获取单条Spu信息(包含Spu销售属性列表)
export function reqSpuById(spuId) {
  return request({
    url: `/admin/product/getSpuById/${spuId}`,
    method: 'get'
  })
}

//删除单条Spu
export function reqDeleteSpuById(spuId) {
  return request({
    url: `/admin/product/deleteSpu/${spuId}`,
    method: 'delete'
  })
}

//保存SKU
export function reqSaveSkuInfo(data) {
  return request({
    url: `/admin/product/saveSkuInfo`,
    method: 'post',
    data
  })
}
